<template>
  <div class="reportFormPage">
    <div class="report-dom horizontal">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">水泥净浆强度试验检测记录表</div>
        <div class="codeText">JGLQ13004</div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>记录编号：</span>
          <span v-if="isPdf" class="placeholder">{{ form.jilbh }}</span>
          <el-input class="code-input" v-else type="text" v-model="form.jilbh" @focus="handleFocus('jilbh')" />
        </div>
      </div>
      <div class="table-border">
        <!------------------------------表头-------------------------->
        <table height="160px" class="top-table">
          <tbody>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程部位/用途</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验检测日期</span>
              </td>
               <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验条件</span>
              </td>
              <td v-if="isPdf" width="35%">
                温度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                ℃；湿度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span>%RH
              </td>
              <td v-else width="35%">
                温度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" style="width: 15%" />℃；湿度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" style="width: 15%" />%RH
              </td>
            </tr>

            <tr>
              <td height="40" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark"
                  @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView"
                  @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="30" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark"
                  @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!------------------------------强度-------------------------->
        <table height="300px" class="middle-table">
          <tbody>
            <tr>
              <td height="25">设计强度(MPa)</td>
              <td colspan="2">
                <el-input type="text" v-model="form.shejqd" @keydown.native="handleKeyDown($event, 0, 0)"
                  :ref="'0_0'" />
              </td>
              <td>试件尺寸(mm)</td>
              <td colspan="5">
                <el-input type="text" v-model="form.shijcc" @keydown.native="handleKeyDown($event, 0, 1)"
                  :ref="'0_1'" />
              </td>
              <td colspan="2">流动度(S)</td>
              <td colspan="2">
                <el-input type="text" v-model="form.liudd" @keydown.native="handleKeyDown($event, 0, 2)" :ref="'0_2'" />
              </td>
            </tr>
            <tr>
              <td height="65" rowspan="2">试件编号</td>
              <td rowspan="2">取样部位</td>
              <td rowspan="2">制件日期</td>
              <td rowspan="2">试验日期</td>
              <td rowspan="2">
                龄期
                <br />(天)
              </td>
              <td colspan="3">抗折强度</td>
              <td colspan="5">抗压强度</td>
            </tr>
            <tr>
              <td height="40">荷载(N)</td>
              <td>
                强度单值
                <br />(MPa)
              </td>
              <td>
                强度均值
                <br />(MPa)
              </td>
              <td colspan="2">荷载(kN)</td>
              <td colspan="2">强度单值(MPa)</td>
              <td>
                强度均值
                <br />(MPa)
              </td>
            </tr>
            <tr height="25">
              <td width="10%">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[0].shijbh"
                  @keydown.native="handleKeyDown($event, 1, 0)" :ref="'1_0'" />
              </td>
              <td width="10%" rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[0].qvybw"
                  @keydown.native="handleKeyDown($event, 1, 1)" :ref="'1_1'" />
              </td>
              <td width="10%" rowspan="3">
                <el-date-picker class="syrqStyle hide-icon" v-model="form.snjjqdjlbBsDetailList[0].zijrq"
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[0].qil, form.snjjqdjlbBsDetailList[0].zijrq, 0)"
                  style="width: 100%" />
              </td>
              <td width="10%" rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[0].shiyrq" disabled />
              </td>
              <td width="5%" rowspan="3">
                <el-select v-model="form.snjjqdjlbBsDetailList[0].qil" class="hide-icon height100" placeholder
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[0].qil, form.snjjqdjlbBsDetailList[0].zijrq, 0)">
                  <el-option :label="3" :value="3"></el-option>
                  <el-option :label="7" :value="7"></el-option>
                  <el-option :label="28" :value="28"></el-option>
                </el-select>
              </td>

              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[0].kangzqdhz, 0)"
                  @keydown.native="handleKeyDown($event, 1, 2)" :ref="'1_2'" />
              </td>
              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangzqddz" disabled />
              </td>
              <td style="width: calc(45% / 8 * 1)" rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangzqdjz" disabled />
              </td>
              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[0].kangyqdhz1, 'kangyqddz1', 0)"
                  @keydown.native="handleKeyDown($event, 1, 3)" :ref="'1_3'" />
              </td>
              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[0].kangyqdhz2, 'kangyqddz2', 0)"
                  @keydown.native="handleKeyDown($event, 1, 4)" :ref="'1_4'" />
              </td>
              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangyqddz1" disabled />
              </td>
              <td style="width: calc(45% / 8 * 1)">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangyqddz2" disabled />
              </td>
              <td style="width: calc(45% / 8 * 1)" rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[0].kangyqdjz" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[1].shijbh"
                  @keydown.native="handleKeyDown($event, 2, 0)" :ref="'2_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[1].kangzqdhz, 1)"
                  @keydown.native="handleKeyDown($event, 2, 2)" :ref="'2_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[1].kangyqdhz1, 'kangyqddz1', 1)"
                  @keydown.native="handleKeyDown($event, 2, 3)" :ref="'2_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[1].kangyqdhz2, 'kangyqddz2', 1)"
                  @keydown.native="handleKeyDown($event, 2, 4)" :ref="'2_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[1].kangyqddz2" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[2].shijbh"
                  @keydown.native="handleKeyDown($event, 3, 0)" :ref="'3_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[2].kangzqdhz, 2)"
                  @keydown.native="handleKeyDown($event, 3, 2)" :ref="'3_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[2].kangyqdhz1, 'kangyqddz1', 2)"
                  @keydown.native="handleKeyDown($event, 3, 3)" :ref="'3_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[2].kangyqdhz2, 'kangyqddz2', 2)"
                  @keydown.native="handleKeyDown($event, 3, 4)" :ref="'3_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[2].kangyqddz2" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[3].shijbh"
                  @keydown.native="handleKeyDown($event, 4, 0)" :ref="'4_0'" />
              </td>
              <td rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[3].qvybw"
                  @keydown.native="handleKeyDown($event, 4, 1)" :ref="'4_1'" />
              </td>
              <td rowspan="3">
                <el-date-picker class="syrqStyle hide-icon" v-model="form.snjjqdjlbBsDetailList[3].zijrq"
                  style="width: 100%"
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[3].qil, form.snjjqdjlbBsDetailList[3].zijrq, 3)" />
              </td>
              <td rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[3].shiyrq" disabled />
              </td>
              <td rowspan="3">
                <el-select v-model="form.snjjqdjlbBsDetailList[3].qil" class="hide-icon height100" placeholder
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[3].qil, form.snjjqdjlbBsDetailList[3].zijrq, 3)">
                  <el-option :label="3" :value="3"></el-option>
                  <el-option :label="7" :value="7"></el-option>
                  <el-option :label="28" :value="28"></el-option>
                </el-select>
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[3].kangzqdhz, 3)"
                  @keydown.native="handleKeyDown($event, 4, 2)" :ref="'4_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangzqddz" disabled />
              </td>
              <td rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangzqdjz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[3].kangyqdhz1, 'kangyqddz1', 3)"
                  @keydown.native="handleKeyDown($event, 4, 3)" :ref="'4_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[3].kangyqdhz2, 'kangyqddz2', 3)"
                  @keydown.native="handleKeyDown($event, 4, 4)" :ref="'4_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangyqddz2" disabled />
              </td>
              <td rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[3].kangyqdjz" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[4].shijbh"
                  @keydown.native="handleKeyDown($event, 5, 0)" :ref="'5_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[4].kangzqdhz, 4)"
                  @keydown.native="handleKeyDown($event, 5, 2)" :ref="'5_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[4].kangyqdhz1, 'kangyqddz1', 4)"
                  @keydown.native="handleKeyDown($event, 5, 3)" :ref="'5_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[4].kangyqdhz2, 'kangyqddz2', 4)"
                  @keydown.native="handleKeyDown($event, 5, 4)" :ref="'5_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[4].kangyqddz2" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[5].shijbh"
                  @keydown.native="handleKeyDown($event, 6, 0)" :ref="'6_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[5].kangzqdhz, 5)"
                  @keydown.native="handleKeyDown($event, 6, 2)" :ref="'6_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[5].kangyqdhz1, 'kangyqddz1', 5)"
                  @keydown.native="handleKeyDown($event, 6, 3)" :ref="'6_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[5].kangyqdhz2, 'kangyqddz2', 5)"
                  @keydown.native="handleKeyDown($event, 6, 4)" :ref="'6_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[5].kangyqddz2" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[6].shijbh"
                  @keydown.native="handleKeyDown($event, 7, 0)" :ref="'7_0'" />
              </td>
              <td rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[6].qvybw"
                  @keydown.native="handleKeyDown($event, 7, 1)" :ref="'7_1'" />
              </td>
              <td rowspan="3">
                <el-date-picker class="syrqStyle hide-icon" v-model="form.snjjqdjlbBsDetailList[6].zijrq"
                  style="width: 100%"
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[6].qil, form.snjjqdjlbBsDetailList[6].zijrq, 6)" />
              </td>
              <td rowspan="3">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[6].shiyrq" disabled />
              </td>
              <td rowspan="3">
                <el-select v-model="form.snjjqdjlbBsDetailList[6].qil"
                  @change="handleSyrq(form.snjjqdjlbBsDetailList[6].qil, form.snjjqdjlbBsDetailList[6].zijrq, 6)"
                  class="hide-icon height100" placeholder>
                  <el-option :label="3" :value="3"></el-option>
                  <el-option :label="7" :value="7"></el-option>
                  <el-option :label="28" :value="28"></el-option>
                </el-select>
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[6].kangzqdhz, 6)"
                  @keydown.native="handleKeyDown($event, 7, 2)" :ref="'7_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangzqddz" disabled />
              </td>
              <td rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangzqdjz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[6].kangyqdhz1, 'kangyqddz1', 6)"
                  @keydown.native="handleKeyDown($event, 7, 3)" :ref="'7_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[6].kangyqdhz2, 'kangyqddz2', 6)"
                  @keydown.native="handleKeyDown($event, 7, 4)" :ref="'7_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangyqddz2" disabled />
              </td>
              <td rowspan="3">
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[6].kangyqdjz" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[7].shijbh"
                  @keydown.native="handleKeyDown($event, 8, 0)" :ref="'8_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[7].kangzqdhz, 7)"
                  @keydown.native="handleKeyDown($event, 8, 2)" :ref="'8_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[7].kangyqdhz1, 'kangyqddz1', 7)"
                  @keydown.native="handleKeyDown($event, 8, 3)" :ref="'8_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[7].kangyqdhz2, 'kangyqddz2', 7)"
                  @keydown.native="handleKeyDown($event, 8, 4)" :ref="'8_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[7].kangyqddz2" disabled />
              </td>
            </tr>
            <tr>
              <td height="25">
                <el-input type="text" v-model="form.snjjqdjlbBsDetailList[8].shijbh"
                  @keydown.native="handleKeyDown($event, 9, 0)" :ref="'9_0'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangzqdhz"
                  @change="handeQddz(form.snjjqdjlbBsDetailList[8].kangzqdhz, 8)"
                  @keydown.native="handleKeyDown($event, 9, 2)" :ref="'9_2'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangzqddz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangyqdhz1"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[8].kangyqdhz1, 'kangyqddz1', 8)"
                  @keydown.native="handleKeyDown($event, 9, 3)" :ref="'9_3'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangyqdhz2"
                  @change="handleQddz(form.snjjqdjlbBsDetailList[8].kangyqdhz2, 'kangyqddz2', 8)"
                  @keydown.native="handleKeyDown($event, 9, 4)" :ref="'9_4'" />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangyqddz1" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.snjjqdjlbBsDetailList[8].kangyqddz2" disabled />
              </td>
            </tr>
          </tbody>
        </table>
        <!------------------------------附加声明-------------------------->
        <table height="30px" class="bottom-table">
          <tr>
            <td>
              <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
            </td>
          </tr>
        </table>
      </div>
      <!------------------------------表底-------------------------->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">记录：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">复核：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
  </div>
</template>

<script>
import { getSnjjqdjlbBsInfo } from "@/api/report_yj/snjjqdjlbBsInfo";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import decimal from "@/utils/big-decimal";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView";
import { handleFocus, handleKeyDown } from "@/views/reportForms/utils";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import Bus from "@/utils/bus";
import { formatDateYD } from "@/utils/index.js";
export default {
  name: "snjjqdjlb",
  components: {
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseView
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    page: {
      type: Number,
      default: () => 0
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    printEmpty: {
      type: Boolean,
      default: () => false
    }
  },
  data () {
    return {
      params: {},
      query: {},
      // 表单参数
      form: {
        snjjqdjlbBsDetailList: [{}, {}, {}, {}, {}, {}, {}, {}, {}]
      },
      // 表单校验
      rules: {
        excelId: [{ required: true, message: "主键不能为空", trigger: "blur" }]
      },
      objNum: {
        0: 0,
        1: 0,
        2: 0,
        3: 3,
        4: 3,
        5: 3,
        6: 6,
        7: 6,
        8: 6
      }
    };
  },
  watch: {
    // form: "busForm"
    form: {
      handler: function (newValue, oldValue) {
        Bus.$emit("setYjqdForm", newValue);
      },
      deep: true,
      immediate: true
    }
  },
  created () {
    this.getInfo();
  },
  methods: {
    formatDateYD,
    // 获取详情
    getInfo () {
      getSnjjqdjlbBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
      });
    },

    // 显示检测依据列表
    showBsJiancyjView () {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj (info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
      Bus.$emit("setSnjjqdsyBgJiancyj", { jiancyj: this.form.jiancyj, jiancyjIds: this.form.jiancyjIds });
    },

    // 显示判定依据列表
    showBsJudgeBaseView () {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge (info) {
       this.form.pandyjIds = info.ids;
      this.form.pandyj = info.label;
    },

    // 显示仪器列表
    showBsInstrumentView () {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument (info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
      Bus.$emit("setSnjjqdsyBgZhuyyqsbmcjbh", { zhuyyqsbmcjbh: this.form.zhuyyqsbmcjbh, shebIds: this.form.shebIds });
    },

    handleFocus (event) {
      handleFocus(event, this.page, this.form[event]);
    },

    handleSyrq (day, time, num) {
      let dayNum = (day || 0) * 86400000;
      let timeYYDD = this.formatDateYD(time);
      const timestamp = +new Date(timeYYDD);
      let syrqNum = timestamp + dayNum;
      if (time) {
        this.form.snjjqdjlbBsDetailList[num].shiyrq = this.formatDateYD(new Date(syrqNum));
      }
    },
    handeQddz (val, num) {
      let data = decimal.round((val * 150) / 64000, 1);
      this.form.snjjqdjlbBsDetailList[num].kangzqddz = Number(data);
      this.handleQdzj(this.objNum[num]);
    },
    handleQdzj (num) {
      if (num == 0) {
        let pjz = (this.form.snjjqdjlbBsDetailList[0].kangzqddz + this.form.snjjqdjlbBsDetailList[1].kangzqddz + this.form.snjjqdjlbBsDetailList[2].kangzqddz) / 3;
        this.form.snjjqdjlbBsDetailList[0].kangzqdjz = decimal.round(pjz, 1);
      } else if (num == 3) {
        let pjz = (this.form.snjjqdjlbBsDetailList[3].kangzqddz + this.form.snjjqdjlbBsDetailList[4].kangzqddz + this.form.snjjqdjlbBsDetailList[5].kangzqddz) / 3;
        this.form.snjjqdjlbBsDetailList[3].kangzqdjz = decimal.round(pjz, 1);
      } else if (num == 6) {
        let pjz = (this.form.snjjqdjlbBsDetailList[6].kangzqddz + this.form.snjjqdjlbBsDetailList[7].kangzqddz + this.form.snjjqdjlbBsDetailList[8].kangzqddz) / 3;
        this.form.snjjqdjlbBsDetailList[6].kangzqdjz = decimal.round(pjz, 1);
      }
    },
    handleQddz (val, name, num) {
      let data = decimal.round((val * 1000) / 1600, 1);
      this.form.snjjqdjlbBsDetailList[num][name] = Number(data);
      this.handleQdjz(this.objNum[num]);
    },
    handleQdjz (num) {
      if (num == 0) {
        let pjz =
          (Number(this.form.snjjqdjlbBsDetailList[0].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[0].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[1].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[1].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[2].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[2].kangyqddz2)) /
          6;
        this.form.snjjqdjlbBsDetailList[0].kangyqdjz = decimal.round(pjz, 1);
      } else if (num == 3) {
        let pjz =
          (Number(this.form.snjjqdjlbBsDetailList[3].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[3].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[4].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[4].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[5].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[5].kangyqddz2)) /
          6;
        this.form.snjjqdjlbBsDetailList[3].kangyqdjz = decimal.round(pjz, 1);
      } else if (num == 6) {
        let pjz =
          (Number(this.form.snjjqdjlbBsDetailList[6].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[6].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[7].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[7].kangyqddz2) +
            Number(this.form.snjjqdjlbBsDetailList[8].kangyqddz1) +
            Number(this.form.snjjqdjlbBsDetailList[8].kangyqddz2)) /
          6;
        this.form.snjjqdjlbBsDetailList[6].kangyqdjz = decimal.round(pjz, 1);
      }
    },
    handleKeyDown (event, rowIndex, colIndex) {
      const maxArr = [2, 4, 4, 4, 4, 4, 4, 4, 4, 4]; // 每一行最多有多少可聚焦输入框（从0开始）
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      const arr = ref.split("_");
      if (arr[0] > 0 && arr[0] <= 9 && !this.$refs[ref]) {
        this.handleKeyDown(event, arr[0], arr[1]);
        return;
      }
      if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>


<style scoped></style>
